package com.camel.base.model;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.camel.core.annotations.AssociationField;
import com.camel.base.enums.SurveyCollectType;
import com.camel.base.enums.SurveyState;
import com.camel.base.enums.YesNo;
import com.camel.core.config.RequestEnumJsonDeserialize;
import com.camel.core.entity.BasePaginationEntity;
import com.camel.core.enumhandler.MyIntegerToEnumHandler;
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import lombok.Data;

import java.io.Serializable;

/**
 * 问卷
 * @author camel
 * @TableName zs_survey
 */
@TableName(value ="zs_survey")
@Data
public class ZsSurvey extends BasePaginationEntity implements Serializable {

    /**
     * 主键
     */
    @TableId(value = "id", type = IdType.AUTO)
    private Integer id;

    /**
     * 编号
     */
    @TableField(value = "code")
    private String code;

    /**
     * 名称
     */
    @TableField(value = "name")
    private String name;

    /**
     * 所属项目ID
     */
    @TableField(value = "project_id")
    private Integer projectId;

    /**
     * 所属项目名称
     */
    @TableField(exist = false)
    @AssociationField(select = "select name from zs_project where id = project_id", name = "project_name")
    private String projectName;

    /**
     * 目标收集份数
     */
    @TableField(value = "collect_num")
    private Integer collectNum;

    /**
     * 已收集份数
     */
    @TableField(value = "current_num")
    private Integer currentNum;

    /**
     * 收集方式
     */
    @TableField(value = "collect_type", typeHandler = MyIntegerToEnumHandler.class)
    @JsonDeserialize(using = RequestEnumJsonDeserialize.class)
    private SurveyCollectType collectType;

    /**
     *
     */
    @TableField(value = "end_show")
    private String endShow;

    /**
     * 欢迎语
     */
    @TableField(value = "start_show")
    private String startShow;

    /**
     * 运行状态
     */
    @TableField(value = "state", typeHandler = MyIntegerToEnumHandler.class)
    @JsonDeserialize(using = RequestEnumJsonDeserialize.class)
    private SurveyState state;

    /**
     * 是否收集手机号
     */
    @TableField(value = "collect_phone")
    private Integer collectPhone;

    /**
     * 说不清的最大可选数量
     */
    @TableField(value = "unclear_count")
    private Integer unclearCount;

    /**
     *
     */
    @TableField(value = "information_template")
    private String informationTemplate;

    /**
     *
     */
    @TableField(value = "customer_group_id")
    private Integer customerGroupId;

    /**
     * 1 自动呼叫  是 0 手动 否
     *
     * JsonDeserialize controller  接收的时候支持 JOSN 和 数字形式的转换
     */
    @TableField(value = "auto_call", typeHandler =MyIntegerToEnumHandler.class)
    @JsonDeserialize(using = RequestEnumJsonDeserialize.class)
    private YesNo autoCall;

    /**
     * 外线号码(默认)
     */
    @TableField(value = "pstn_number")
    private String pstnNumber;

    /**
     * 公司名称
     */
    @TableField(value = "company_name")
    private String companyName;

    /**
     * 公司ID
     */
    @TableField(value = "company_id")
    private Integer companyId;
}
